import request from '@/utils/request'

/**
 * @description 获取用户列表
 * @param data
 */
export const getUserPages = (data = {}) => {
  return request.post('/boss/user/getUserPages', {
    ...data
  })
}
/**
 * @description 禁用用户
 * @param userId
 */
export const forbidUser = (userId: string | number) => {
  return request.get('/boss/user/forbidUser', {
    params: {
      userId
    }
  })
}

/**
 * @description 获取角色字典项
 */
export const getUserRoleMenuLists = () => {
  return request.get('/boss/role/all')
}

/**
 * @description 给用户分配角色
 */
export const allocateUserRoles = (data = {}) => {
  const oldData = {
    userId: 0,
    roleIdList: []
  }
  return request.post('/boss/role/allocateUserRoles', {
    ...oldData,
    ...data
  })
}

/**
 * @description 根据useId获取已有角色
 */
export const getRolesByUserId = (userId: number) => {
  return request.get(`/boss/role/user/${userId}`)
}
